#ifndef READCONFIG_H
#define READCONFIG_H
#include <string>
#include <map>
#include <iostream>
using std::cout;
using std::endl;
using std::cerr;
namespace moqi
{
using std::string;
using std::map;
class ReadConfig
{

    class AutoRelease
    {
    public:
        AutoRelease()
        {
            cout << __FUNCTION__ << endl;
        }
        ~AutoRelease()
        {
            cout << __FUNCTION__ << endl;
            if(_pInstence)
            {
                delete _pInstence;
                _pInstence = nullptr;
            }
        }
    };

public:
    static ReadConfig* getInstance();
    static void deleteInstance();
    void read(const string& filename);
    string get(const string& key) const;
private:
    ReadConfig();
    ~ReadConfig();
    static ReadConfig* _pInstence;
    static AutoRelease _ar;
    map<string, string> _configPairs;
};

}
#endif
